<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Eigen: Eigen::Reshaped&lt; XprType, Rows, Cols, Order &gt; Class Template Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  $(document).ready(function() { init_search(); });
/* @license-end */
</script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="eigendoxy.css" rel="stylesheet" type="text/css">
<!--  -->
<script type="text/javascript" src="eigen_navtree_hacks.js"></script>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="Eigen_Silly_Professor_64x64.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname"><a href="http://eigen.tuxfamily.org">Eigen</a>
   &#160;<span id="projectnumber">3.4.90 (git rev 67eeba6e720c5745abc77ae6c92ce0a44aa7b7ae)</span>
   </div>
  </td>
   <td>        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.svg"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.svg" alt=""/></a>
          </span>
        </div>
</td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('classEigen_1_1Reshaped.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="classEigen_1_1Reshaped-members.html">List of all members</a> &#124;
<a href="#pub-methods">Public Member Functions</a>  </div>
  <div class="headertitle">
<div class="title">Eigen::Reshaped&lt; XprType, Rows, Cols, Order &gt; Class Template Reference<div class="ingroups"><a class="el" href="group__DenseMatrixManipulation__chapter.html">Dense matrix and array manipulation</a> &raquo; <a class="el" href="group__DenseMatrixManipulation__Reference.html">Reference</a> &raquo; <a class="el" href="group__Core__Module.html">Core module</a></div></div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><h3>template&lt;typename XprType, int Rows, int Cols, int Order&gt;<br />
class Eigen::Reshaped&lt; XprType, Rows, Cols, Order &gt;</h3>

<p>Expression of a fixed-size or dynamic-size reshape. </p>
<dl class="tparams"><dt>Template Parameters</dt><dd>
  <table class="tparams">
    <tr><td class="paramname">XprType</td><td>the type of the expression in which we are taking a reshape </td></tr>
    <tr><td class="paramname">Rows</td><td>the number of rows of the reshape we are taking at compile time (optional) </td></tr>
    <tr><td class="paramname">Cols</td><td>the number of columns of the reshape we are taking at compile time (optional) </td></tr>
    <tr><td class="paramname">Order</td><td>can be ColMajor or RowMajor, default is ColMajor.</td></tr>
  </table>
  </dd>
</dl>
<p>This class represents an expression of either a fixed-size or dynamic-size reshape. It is the return type of DenseBase::reshaped(NRowsType,NColsType) and most of the time this is the only way it is used.</p>
<p>If you want to directly manipulate reshaped expressions, for instance if you want to write a function returning such an expression, it is advised to use the <em>auto</em> keyword for such use cases.</p>
<p>Here is an example illustrating the dynamic case: </p><div class="fragment"><div class="line"><span class="preprocessor">#include &lt;Eigen/Core&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;iostream&gt;</span></div>
<div class="line"> </div>
<div class="line"><span class="keyword">template</span>&lt;<span class="keyword">typename</span> Derived&gt;</div>
<div class="line"><span class="keyword">const</span> <a class="code" href="classEigen_1_1Reshaped.html">Eigen::Reshaped&lt;const Derived&gt;</a></div>
<div class="line">reshape_helper(<span class="keyword">const</span> <a class="code" href="classEigen_1_1MatrixBase.html">Eigen::MatrixBase&lt;Derived&gt;</a>&amp; m, <span class="keywordtype">int</span> rows, <span class="keywordtype">int</span> cols)</div>
<div class="line">{</div>
<div class="line">  <span class="keywordflow">return</span> <a class="code" href="classEigen_1_1Reshaped.html">Eigen::Reshaped&lt;const Derived&gt;</a>(m.<a class="code" href="classEigen_1_1DenseCoeffsBase_3_01Derived_00_01DirectWriteAccessors_01_4.html#a1fbabe7f12bcbfba3b9a448b1f5e46fa">derived</a>(), rows, cols);</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> main(<span class="keywordtype">int</span>, <span class="keywordtype">char</span>**)</div>
<div class="line">{</div>
<div class="line">  <a class="code" href="classEigen_1_1Matrix.html">Eigen::MatrixXd</a> m(3, 4);</div>
<div class="line">  m &lt;&lt; 1, 4, 7, 10,</div>
<div class="line">       2, 5, 8, 11,</div>
<div class="line">       3, 6, 9, 12;</div>
<div class="line">  std::cout &lt;&lt; m &lt;&lt; std::endl;</div>
<div class="line">  <a class="code" href="classEigen_1_1Ref.html">Eigen::Ref&lt;const Eigen::MatrixXd&gt;</a> n = reshape_helper(m, 2, 6);</div>
<div class="line">  std::cout &lt;&lt; <span class="stringliteral">&quot;Matrix m is:&quot;</span> &lt;&lt; std::endl &lt;&lt; m &lt;&lt; std::endl;</div>
<div class="line">  std::cout &lt;&lt; <span class="stringliteral">&quot;Matrix n is:&quot;</span> &lt;&lt; std::endl &lt;&lt; n &lt;&lt; std::endl;</div>
<div class="line">}</div>
<div class="ttc" id="aclassEigen_1_1DenseCoeffsBase_3_01Derived_00_01DirectWriteAccessors_01_4_html_a1fbabe7f12bcbfba3b9a448b1f5e46fa"><div class="ttname"><a href="classEigen_1_1DenseCoeffsBase_3_01Derived_00_01DirectWriteAccessors_01_4.html#a1fbabe7f12bcbfba3b9a448b1f5e46fa">Eigen::DenseCoeffsBase&lt; Derived, DirectWriteAccessors &gt;::derived</a></div><div class="ttdeci">Derived &amp; derived()</div><div class="ttdef"><b>Definition:</b> EigenBase.h:48</div></div>
<div class="ttc" id="aclassEigen_1_1MatrixBase_html"><div class="ttname"><a href="classEigen_1_1MatrixBase.html">Eigen::MatrixBase</a></div><div class="ttdoc">Base class for all dense matrices, vectors, and expressions.</div><div class="ttdef"><b>Definition:</b> MatrixBase.h:52</div></div>
<div class="ttc" id="aclassEigen_1_1Matrix_html"><div class="ttname"><a href="classEigen_1_1Matrix.html">Eigen::Matrix</a></div><div class="ttdoc">The matrix class, also used for vectors and row-vectors.</div><div class="ttdef"><b>Definition:</b> Matrix.h:182</div></div>
<div class="ttc" id="aclassEigen_1_1Ref_html"><div class="ttname"><a href="classEigen_1_1Ref.html">Eigen::Ref</a></div><div class="ttdoc">A matrix or vector expression mapping an existing expression.</div><div class="ttdef"><b>Definition:</b> Ref.h:285</div></div>
<div class="ttc" id="aclassEigen_1_1Reshaped_html"><div class="ttname"><a href="classEigen_1_1Reshaped.html">Eigen::Reshaped</a></div><div class="ttdoc">Expression of a fixed-size or dynamic-size reshape.</div><div class="ttdef"><b>Definition:</b> Reshaped.h:99</div></div>
</div><!-- fragment --><p> Output: </p><pre class="fragment"> 1  4  7 10
 2  5  8 11
 3  6  9 12
Matrix m is:
 1  4  7 10
 2  5  8 11
 3  6  9 12
Matrix n is:
 1  3  5  7  9 11
 2  4  6  8 10 12
</pre><p>Here is an example illustrating the fixed-size case: </p><div class="fragment"><div class="line"><span class="preprocessor">#include &lt;Eigen/Core&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;iostream&gt;</span></div>
<div class="line"> </div>
<div class="line"><span class="keyword">template</span>&lt;<span class="keyword">typename</span> Derived&gt;</div>
<div class="line"><a class="code" href="classEigen_1_1Reshaped.html">Eigen::Reshaped&lt;Derived, 4, 2&gt;</a></div>
<div class="line">reshape_helper(<a class="code" href="classEigen_1_1MatrixBase.html">Eigen::MatrixBase&lt;Derived&gt;</a>&amp; m)</div>
<div class="line">{</div>
<div class="line">  <span class="keywordflow">return</span> <a class="code" href="classEigen_1_1Reshaped.html">Eigen::Reshaped&lt;Derived, 4, 2&gt;</a>(m.<a class="code" href="classEigen_1_1DenseCoeffsBase_3_01Derived_00_01DirectWriteAccessors_01_4.html#a1fbabe7f12bcbfba3b9a448b1f5e46fa">derived</a>());</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> main(<span class="keywordtype">int</span>, <span class="keywordtype">char</span>**)</div>
<div class="line">{</div>
<div class="line">  <a class="code" href="classEigen_1_1Matrix.html">Eigen::MatrixXd</a> m(2, 4);</div>
<div class="line">  m &lt;&lt; 1, 2, 3, 4,</div>
<div class="line">       5, 6, 7, 8;</div>
<div class="line">  <a class="code" href="classEigen_1_1Matrix.html">Eigen::MatrixXd</a> n = reshape_helper(m);</div>
<div class="line">  std::cout &lt;&lt; <span class="stringliteral">&quot;matrix m is:&quot;</span> &lt;&lt; std::endl &lt;&lt; m &lt;&lt; std::endl;</div>
<div class="line">  std::cout &lt;&lt; <span class="stringliteral">&quot;matrix n is:&quot;</span> &lt;&lt; std::endl &lt;&lt; n &lt;&lt; std::endl;</div>
<div class="line">  <span class="keywordflow">return</span> 0;</div>
<div class="line">}</div>
</div><!-- fragment --><p> Output: </p><pre class="fragment">matrix m is:
1 2 3 4
5 6 7 8
matrix n is:
1 3
5 7
2 4
6 8
</pre><dl class="section see"><dt>See also</dt><dd>DenseBase::reshaped(NRowsType,NColsType) </dd></dl>
</div>
<p>Inherits Eigen::ReshapedImpl&lt; XprType, Rows, Cols, Order, internal::traits&lt; XprType &gt;::StorageKind &gt;.</p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a6de25b03b93cb3dc55ba7fcafae87984"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classEigen_1_1Reshaped.html#a6de25b03b93cb3dc55ba7fcafae87984">Reshaped</a> (XprType &amp;xpr)</td></tr>
<tr class="separator:a6de25b03b93cb3dc55ba7fcafae87984"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a26f25c9bc61d72ae9db5d62112d4a26a"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classEigen_1_1Reshaped.html#a26f25c9bc61d72ae9db5d62112d4a26a">Reshaped</a> (XprType &amp;xpr, <a class="el" href="namespaceEigen.html#a62e77e0933482dafde8fe197d9a2cfde">Index</a> reshapeRows, <a class="el" href="namespaceEigen.html#a62e77e0933482dafde8fe197d9a2cfde">Index</a> reshapeCols)</td></tr>
<tr class="separator:a26f25c9bc61d72ae9db5d62112d4a26a"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="a6de25b03b93cb3dc55ba7fcafae87984"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6de25b03b93cb3dc55ba7fcafae87984">&#9670;&nbsp;</a></span>Reshaped() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename XprType , int Rows, int Cols, int Order&gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classEigen_1_1Reshaped.html">Eigen::Reshaped</a>&lt; XprType, Rows, Cols, Order &gt;::<a class="el" href="classEigen_1_1Reshaped.html">Reshaped</a> </td>
          <td>(</td>
          <td class="paramtype">XprType &amp;&#160;</td>
          <td class="paramname"><em>xpr</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Fixed-size constructor </p>

</div>
</div>
<a id="a26f25c9bc61d72ae9db5d62112d4a26a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a26f25c9bc61d72ae9db5d62112d4a26a">&#9670;&nbsp;</a></span>Reshaped() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename XprType , int Rows, int Cols, int Order&gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classEigen_1_1Reshaped.html">Eigen::Reshaped</a>&lt; XprType, Rows, Cols, Order &gt;::<a class="el" href="classEigen_1_1Reshaped.html">Reshaped</a> </td>
          <td>(</td>
          <td class="paramtype">XprType &amp;&#160;</td>
          <td class="paramname"><em>xpr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="namespaceEigen.html#a62e77e0933482dafde8fe197d9a2cfde">Index</a>&#160;</td>
          <td class="paramname"><em>reshapeRows</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="namespaceEigen.html#a62e77e0933482dafde8fe197d9a2cfde">Index</a>&#160;</td>
          <td class="paramname"><em>reshapeCols</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Dynamic-size constructor </p>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="Reshaped_8h_source.html">Reshaped.h</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="namespaceEigen.html">Eigen</a></li><li class="navelem"><a class="el" href="classEigen_1_1Reshaped.html">Reshaped</a></li>
    <li class="footer">Generated on Thu Apr 21 2022 13:07:56 for Eigen by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.9.1 </li>
  </ul>
</div>
</body>
</html>
